﻿using UnityEngine;
using System.Collections;
using UnityEngine.Events;

public class Event<T>
{
    class MyEvent : UnityEvent<T> {}

    UnityEvent<T> uEvent = new MyEvent();

    public void Fire(T t)
    {
        uEvent.Invoke(t);
    }

    public void Listen(UnityAction<T> uAction)
    {
        uEvent.AddListener(uAction);
    }
}

public class Event<T, T2>
{
    class MyEvent : UnityEvent<T, T2> { }

    UnityEvent<T, T2> uEvent = new MyEvent();

    public void Fire(T t, T2 t2)
    {
        uEvent.Invoke(t, t2);
    }

    public void Listen(UnityAction<T, T2> uAction)
    {
        uEvent.AddListener(uAction);
    }
}

public class Event<T, T2, T3>
{
    class MyEvent : UnityEvent<T, T2, T3> { }

    UnityEvent<T, T2, T3> uEvent = new MyEvent();

    public void Fire(T t, T2 t2, T3 t3)
    {
        uEvent.Invoke(t, t2, t3);
    }

    public void Listen(UnityAction<T, T2, T3> uAction)
    {
        uEvent.AddListener(uAction);
    }
}

public class Event<T, T2, T3, T4>
{
    class MyEvent : UnityEvent<T, T2, T3, T4> { }

    UnityEvent<T, T2, T3, T4> uEvent = new MyEvent();

    public void Fire(T t, T2 t2, T3 t3, T4 t4)
    {
        uEvent.Invoke(t, t2, t3, t4);
    }

    public void Listen(UnityAction<T, T2, T3, T4> uAction)
    {
        uEvent.AddListener(uAction);
    }
}
